package com.cyan.note.common;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 响应状态码枚举
 * 
 * @author ZhangzhenYu
 * @since 2025-01-13
 */
@Getter
@AllArgsConstructor
public enum ResultCode {

    // 通用状态码
    SUCCESS(200, "操作成功"),
    ERROR(500, "系统异常"),
    FAIL(400, "操作失败"),
    PARAM_ERROR(400, "参数错误"),
    PARAM_VALID_ERROR(400, "参数校验失败"),
    
    // 认证相关
    UNAUTHORIZED(401, "未授权"),
    TOKEN_INVALID(401, "Token无效"),
    TOKEN_EXPIRED(401, "Token已过期"),
    TOKEN_REFRESH_REQUIRED(401, "Token需要刷新"),
    FORBIDDEN(403, "权限不足"),
    
    // 用户相关
    USER_NOT_FOUND(404, "用户不存在"),
    USER_DISABLED(403, "用户已被禁用"),
    USERNAME_EXISTS(400, "用户名已存在"),
    PASSWORD_ERROR(400, "密码错误"),
    LOGIN_FAIL(400, "登录失败"),
    
    // 店铺相关
    SHOP_NOT_FOUND(404, "店铺不存在"),
    SHOP_DISABLED(403, "店铺已被停用"),
    SHOP_ACCESS_DENIED(403, "无权限访问该店铺"),
    
    // 订单相关
    ORDER_NOT_FOUND(404, "订单不存在"),
    ORDER_STATUS_ERROR(400, "订单状态错误"),
    ORDER_WORKER_CONFLICT(400, "打手冲突"),
    ORDER_TIMEOUT(408, "订单超时"),
    
    // 打手相关
    WORKER_NOT_FOUND(404, "打手不存在"),
    WORKER_BUSY(400, "打手忙碌中"),
    WORKER_OFFLINE(400, "打手离线"),
    
    // 客户相关
    CUSTOMER_NOT_FOUND(404, "客户不存在"),
    CUSTOMER_BLACKLISTED(403, "客户已被拉黑"),
    
    // 服务相关
    SERVICE_NOT_FOUND(404, "服务不存在"),
    SERVICE_OFFLINE(400, "服务已下架"),
    
    // 数据相关
    DATA_NOT_FOUND(404, "数据不存在"),
    DATA_EXISTS(400, "数据已存在"),
    DATA_INTEGRITY_ERROR(400, "数据完整性错误"),
    NOT_FOUND(404, "资源不存在"),
    OPERATION_FAILED(500, "操作失败"),
    DUPLICATE_RESOURCE(400, "资源已存在"),
    
    // 文件相关
    FILE_NOT_FOUND(404, "文件不存在"),
    FILE_UPLOAD_ERROR(500, "文件上传失败"),
    FILE_TYPE_ERROR(400, "文件类型错误"),
    FILE_SIZE_ERROR(400, "文件大小超限"),
    
    // 网络相关
    NETWORK_ERROR(500, "网络异常"),
    TIMEOUT(408, "请求超时"),
    TOO_MANY_REQUESTS(429, "请求过于频繁");

    /**
     * 状态码
     */
    private final Integer code;

    /**
     * 状态消息
     */
    private final String message;
}